package org.reborn.utils

object Util {

  def loop(from:Int,loopCondition:(Int)=>Boolean,inc:Int)(block:(Int)=>Unit):Unit = {
    var index = from
    while(loopCondition(index)){
      block(index)
      index = index + 1
    }
  }
  
  def rloop(from:Int,loopCondition:(Int)=>Boolean,inc:Int)(block:(Int)=>Unit):Unit = {
    if(loopCondition(from)){
      block(from)
      rloop(from + inc, loopCondition, inc){block}
    }
    
  }
  
  def loop(from:Int,until:Int)(block:(Int)=>Unit):Unit = {
    var index = from
    while(index < until){
      block(index)
      index = index + 1
    }
  }

}

case class MatchVal[T](val intVal:T)
